<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet"
	type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>商户订单管理</title>
<style>
.title {
	display: block;
	background: #5a98de;
	line-height: 31px;
	float: left;
	color: white;
	width: 95px;
	text-align: center;
}

.title:hover {
	text-decoration: none;
	color:black;
}
.rleft{
border-top-left-radius:5px;border-bottom-left-radius:5px;
}
.rright{
border-top-right-radius:5px;border-bottom-right-radius:5px;
}
.blue{
	background:#5a98de;
	color:white;
	border:1px solid #5a98de;
}
.def{
	background:white;
	color:black;
	border:1px solid black;
}
</style>
</head>
<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 商家中心 <span class="c-gray en">&gt;</span> 商户订单管理 
		<a class="btn btn-success btn-refresh radius r mr-20"
			style="line-height:1.6em;margin-top:3px"
			onclick="javascript:location.replace(location.href);"
			href="javascript:location.replace(location.href);" title="刷新"><i
			class="Hui-iconfont">&#xe68f;</i></a>
	</nav>
	<div class="pd-20">
		<div class="cl pd-5 bg-1 bk-gray">
			<a id="one" name="1" class="title rleft def">全部</a>
			<a id="two" name="2" class="title def">待处理</a>
			<a id="three" name="3" class="title def">正在处理</a>
			<a id="four" name="4" class="title def">配送中</a>
			<a id="five" name="5" class="title rright def">已完成</a>
			<%-- <span class="l"> <a class="btn btn-primary radius" onclick="shop_add('添加商户','<%=path%>/backstage/shop-add-pre')"
				href="javascript:;"> 添加商户</a></span> --%>
		</div>
		<div class="cl pd-5 bg-1 bk-gray" style="margin-top:20px;">

			<form action="<%=path%>/backstage/shop-order" method="post"
				class="form form-horizontal" id="form-goods-add">
				<input type="hidden" value="${cond.status }" name="status" id="status">
				<div class="text-c">
					<div class="row c1">
					<label class="form-label col-1">收货电话：</label>
					<div class="formControls col-2">
						<input type="text" value="${cond.mobile }" name="mobile" id="mobile" placeholder="收货电话" class="input-text re">
					</div>
					<label class="form-label col-1">订单号：</label>
					<div class="formControls col-2">
						<input type="text" value="${cond.titles }" name="titles" id="titles" placeholder="订单号" class="input-text re">
					</div>
					<label class="form-label col-1">收货人：</label>
					<div class="formControls col-2">
						<input type="text" value="${cond.name }" name="name" id="name" placeholder="收货人" class="input-text re">
					</div>
					<label class="form-label col-1">下单方式：</label>
					<div class="formControls col-2">
						<span class="select-box"> <select name="zftype"
							class="select">
								<option value="-1">默认</option>
								<option <c:if test="${cond.zftype==0 }">selected</c:if> value="0">余额支付</option>
								<option <c:if test="${cond.zftype==1 }">selected</c:if> value="1">支付宝支付</option>
								<option <c:if test="${cond.zftype==2 }">selected</c:if> value="2">微信支付</option>
								<option <c:if test="${cond.zftype==3 }">selected</c:if> value="3">货到付款</option>
						</select>
						</span>
					</div>
					</div>
					<div class="row c1">
					<label class="form-label col-1">配送员：</label>
					<div class="formControls col-2">
						<span class="select-box"> <select name="cmob"
							class="select">
								<option value="">默认</option>
								<c:forEach items="${psy }" var="ps">
									<option <c:if test="${cond.cmob==ps.c_mob }">selected</c:if> value="${ps.c_mob }">${ps.c_tname }</option>
								</c:forEach>
						</select>
						</span>
					</div>
					<label class="form-label col-1">下单时间：</label>
					<div class="formControls col-2">
						<input type="text"  name="stime"  onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'datemax\')}'})"  value="${cond.stime}"  id="datemin" class="input-text Wdate">
					</div>
					<!-- <label class="form-label col-1">截止时间：</label> -->
					<div class="formControls col-2">
						<input type="text" name="etime" value="${cond.etime}" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'datemin\')}'})" id="datemax" class="input-text Wdate">
					</div>
					</div>
					<div class="row cl">
					<button name="" id="" class="btn btn-success" style="border-radius:5px;float:right;" type="submit">
						 查询
					</button>
					<div style="width:10px;height:5px;float:right;"></div>
					<button name="" id="reset" class="btn btn-success" style="border-radius:5px;float:right;"  type="button">
						 重置
					</button>
					</div>
				</div>
			</form>

		</div>

		<div class="mt-20">
			<table
				class="table table-border table-bordered table-hover table-bg table-sort">
				<thead>
					<tr class="text-c">
						<th>商家编号</th>
						<th>商家名称</th>
						<th>订单号</th>
						<th>订单状态</th>
						<th>下单方式</th>
						<th>金额</th>
						<th>商家电话</th>
						<th>收货人</th>
						<th>收货电话</th>
						<th>收货地址</th>
						<th>下单时间</th>
						<th>配送时间</th>
						<th>完成时间</th>
						<th>配送员</th>
						<th>配送评价</th>
						<th>商品评价</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${orders}" var="order">
						<input type="hidden" id="orderid" name="orderid" value='${order.titles}' />
						<tr class="text-c">
							<td>${order.shop_id}</td>
							<td>${order.c_sname}</td>
							<td>${order.titles}</td>
							<td>${order.str}</td>
							<td>
								<c:if test="${order.zf_type==0 }">余额支付</c:if>
								<c:if test="${order.zf_type==1 }">支付宝支付</c:if>
								<c:if test="${order.zf_type==2 }">微信支付</c:if>
								<c:if test="${order.zf_type==3 }">货到付款</c:if>
							</td>
							<td>${order.paymoney }</td>
							<td>${order.c_mobi }</td>
							<td>${order.name }</td>
							<td>${order.mobile }</td>
							<td>${order.address }</td>
							<td>${fn:split(order.appdate,'.')[0]}</td>
							<td>${order.senddate }</td>
							<td>${fn:split(order.arrive_user_time,'.')[0]}</td>
							<td>${order.c_tname }</td>
							<td>${order.shipping_remark }</td>
							<td>${order.dp }</td>
							<td class="td-manage"><%-- <a style="text-decoration:none"
								onClick="shop_edit(this,'${shop.cId}')" href="javascript:;"
								title="编辑">编辑 &nbsp;&nbsp; <a style="text-decoration:none"
									onClick="shop_enable(this,'${shop.cId}')" href="javascript:;"
									title="审核">审核</a>&nbsp;&nbsp; <a style="text-decoration:none"
									onClick="shop_del(this,'${shop.cId}')" href="javascript:;"
									title="查看">查看</a> --%>
									<a style="text-decoration:none" onclick="show('订单详情','<%=path%>/backstage/order-details?rid=${order.rid}');" href="javascript:;" title="详情">详情</a>
							</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
	</div>
	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
	<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript"
		src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="js/H-ui.js"></script>
	<script type="text/javascript" src="js/H-ui.admin.js"></script>
	<script type="text/javascript">
		$(function() {
			$('.table-sort').dataTable({
				"aaSorting" : [ [ 0, "desc" ] ],//默认第几个排序
				"bStateSave" : true,//状态保存
				"aoColumnDefs" : [
				//{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
				{
					"orderable" : false,
					"aTargets" : [ 1, 2 ]
				} // 制定列不参与排序
				]
			});
			$('.table-sort tbody').on('click', 'tr', function() {
				if ($(this).hasClass('selected')) {
					$(this).removeClass('selected');
				} else {
					table.$('tr.selected').removeClass('selected');
					$(this).addClass('selected');
				}
			});
			$("#reset").click(function(){
				$(".re").val("");
				$(".select").val("");
				$(".Wdate").val("");
			});
		});
		
		/*添加*/
		function shop_add(title,url){
			var index = layer.open({
				type: 2,
				title: title,
				content: url
			});
			layer.full(index);
		}
		/*编辑*/
		function shop_edit(obj,id,w,h){
			var edit_page = "<%=path%>/backstage/shop-add-pre?id="+id;
			var index = layer.open({
				type: 2,
				title: "编辑",
				content: edit_page
			});
			layer.full(index);
		}
		/*查看*/
		function show(title,url){
			var index = layer.open({
			type: 2,
			title: title,
			content: url
			});
			layer.full(index);
		}
		/*查看*/
		function shop_del(obj,id,w,h){
			var edit_page = "<%=path%>/backstage/shop-del-pre?id="+id;
			var index = layer.open({
				type: 2,
				title: "查看",
				content: edit_page
			});
			layer.full(index);
		}
		/*审核*/
		function shop_enable(obj,id){
			layer.confirm('审核商户?', {
				btn: ['通过','不通过'], 
				shade: false
			},function(){
				$.ajax({
					type : "POST",
					url : "<%=path%>/backstage/shop-enable",
					data : "c_id=" + id,
					error : function() {
						layer.msg('操作失败', {
							icon : 5,
							time : 1000
						});
					},
					success : function(msg) {
						$(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已审核</span>');
						$(obj).remove();
						layer.msg('已审核'+ msg.information, {
							icon : 6,
							time : 1000
						});
					}
				});
				}, function() {
					layer.msg('未通过', {
					icon : 5,
					time : 1000
				});
		});
		}
		
		$(".title").click(function(){
			$(".title").css({"background":"white","border":"1px solid black","color":"black"});
			$(this).css({"background":"#5a98de","border":"1px solid #5a98de"});
			$("#status").val($(this).attr("name"));
			$("#form-goods-add").submit();
		});
		
		if($("#status").val()==1){
			$(".title").css({"background":"white","border":"1px solid black","color":"black"});
			$("#one").css({"background":"#5a98de","border":"1px solid #5a98de"});
		}else if($("#status").val()==2){
			$(".title").css({"background":"white","border":"1px solid black","color":"black"});
			$("#two").css({"background":"#5a98de","border":"1px solid #5a98de"});
		}else if($("#status").val()==3){
			$(".title").css({"background":"white","border":"1px solid black","color":"black"});
			$("#three").css({"background":"#5a98de","border":"1px solid #5a98de"});
		}else if($("#status").val()==4){
			$(".title").css({"background":"white","border":"1px solid black","color":"black"});
			$("#four").css({"background":"#5a98de","border":"1px solid #5a98de"});
		}else if($("#status").val()==5){
			$(".title").css({"background":"white","border":"1px solid black","color":"black"});
			$("#five").css({"background":"#5a98de","border":"1px solid #5a98de"});
		}

		/*图片-下架*/
		function product_stop(obj, id) {
			layer.confirm('确认要下架吗？',
				function(index) {
				$(obj).parents("tr").find(".td-manage").prepend('<a style="text-decoration:none" onClick="product_start(this,id)" href="javascript:;" title="发布"><i class="Hui-iconfont">&#xe603;</i></a>');
				$(obj).parents("tr").find(".td-status").html('<span class="label label-defaunt radius">已下架</span>');
				$(obj).remove();
				layer.msg('已下架!', {
					icon : 5,
					time : 1000
				});
			});
		}
	</script>
</body>
</html>